// index.js
// 获取应用实例
const app = getApp()
import { request } from '../../request/index'
Page({
  data: {
    swiperList: [],
    cateList: [],
    floorList: []
  },
  onLoad() {
    this.getSwiperList()
    this.getCateList()
    this.getFloorList()
  },
  //轮播图数据
  getSwiperList() {
    request({ url: "/home/swiperdata" }).then(result => {
      result.data.message.filter(v => v.navigator_url = v.navigator_url.replace("main", "index"))
      result.data.message.filter(v => v.navigator_url = v.navigator_url.replace("goods_detail", "good-detail"))
      this.setData({
        swiperList: result.data.message
      })
    })
  },
  // 分类数据
  getCateList() {
    request({ url: "/home/catitems" }).then(result => {
      this.setData({
        cateList: result.data.message
      })
    }
    )
  },
  // 楼层数据
  getFloorList() {
    request({ url: "/home/floordata" }).then(result => {
      result.data.message.filter(v => v.product_list.filter(v => v.navigator_url = v.navigator_url.replace("goods_list", "good-list/index")))
      console.log(result);
      this.setData({
        floorList: result.data.message
      })
    }
    )
  }
})
